using FluentNHibernate.Mapping;
using Wikey.Entity;

namespace Wikey.Domain.Mappings
{
    public class CommentMap : ClassMap<Comment> {
        public CommentMap() {
            Id(x => x.Id);
            Map(x => x.Title).Length(100);
            Map(x => x.Text).Length(8000);
            Map(x => x.Created);
            References(x => x.Page).Column("PageId").Cascade.All();
            Component(x => x.Identity,
                      identity =>
                      {
                          identity.Map(i => i.Name).Length(100);
                          identity.Map(i => i.Website).Length(200);
                          identity.Map(i => i.OpenID).Length(100);
                          identity.References(i => i.SysUser).Column("UserId").Cascade.All();
                      });

            Not.LazyLoad();
        }
    }
}